class S_data(dataset_1):
    def __init__(self,sample,start,end,mode,rotate,color_transform,span_size):
        super().__init__(sample,start,end,mode,rotate,color_transform)
        self.span_size = span_size

    def __iter__(self):
        for i in range(self.start,self.end):
            image = image_load(self.image_path.iloc[i]).convert('RGB')
            image = image.resize(self.size,resample=0)

            if self.mode == 'train':
                for i in range(self.span_size):
                    seed_1 = np.random.randint(0,2)     #让输出的图片有可能是原图，不让原图的特征丢失
                    if seed_1 == 0 :
                        out = self.color_transform(image)
                        out = self.rotate(out)
                    else :
                        out = image
                    out = np.array(out,dtype='float32')/255
                    out = np.transpose(out,(2,0,1))
                    y = np.array(self.image_label.iloc[i],dtype='int64')
                    yield out , y

            elif self.mode =='valid':
                out = image
                out = np.array(out,dtype='float32')/255
                out = np.transpose(out,(2,0,1))
                y = np.array(self.image_label.iloc[i],dtype='int64')
                yield out , y

            elif self.mode == 'test':
                out = image
                out = np.array(out,dtype='float32')/255
                out = np.transpose(out,(2,0,1))
                yield out

            else :
                print('请输入正确的模式[''train'',''test'',''valid'']')
